package com.xhs.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 登录响应DTO
 *
 * @author xhs
 */
@Data
@Schema(description = "登录响应")
public class LoginResponse {

    /**
     * 会话ID
     */
    @Schema(description = "会话ID", example = "abc123")
    private String sessionId;

    /**
     * 手机号
     */
    @Schema(description = "手机号", example = "13800138000")
    private String phoneNumber;

    /**
     * 登录状态
     */
    @Schema(description = "登录状态", example = "SUCCESS")
    private String status;

    /**
     * 响应内容
     */
    @Schema(description = "响应内容", example = "登录完成，当前URL: https://www.xiaohongshu.com/explore")
    private String responseContent;

    /**
     * 错误信息
     */
    @Schema(description = "错误信息")
    private String errorMessage;

    public static LoginResponse success(String sessionId, String phoneNumber, String responseContent) {
        LoginResponse response = new LoginResponse();
        response.setSessionId(sessionId);
        response.setPhoneNumber(phoneNumber);
        response.setStatus("SUCCESS");
        response.setResponseContent(responseContent);
        return response;
    }

    public static LoginResponse error(String sessionId, String phoneNumber, String errorMessage) {
        LoginResponse response = new LoginResponse();
        response.setSessionId(sessionId);
        response.setPhoneNumber(phoneNumber);
        response.setStatus("ERROR");
        response.setErrorMessage(errorMessage);
        return response;
    }
} 